package demo01_extense;

public class Test {
    public static void main(String[] args) {

        Dog dog=new Dog();
        use(dog);
        Cat cat=new Cat();
        use(cat);
    }

    public static void use(Animal a){
        a.eat();
        if (a instanceof Dog){
            Dog d=(Dog)a;
            d.lookHome();
        }else if (a instanceof Cat){
            Cat c=(Cat)a;
            c.getMouse();
        }
    }
}
